﻿<script type="text/javascript">
    $(document).ready(function () {
        $('#optLang').change(function () {
            $.ajax({
                url: '@Url.Content("~/Home/ChangeLanguage")'
                , type: "POST"
                , data: { LCID: $(this).val() }
            }).done(function () {
                location.reload();
            });
        });
    });
</script>

<span>@Xource.LocalizedContent.SelectLanguage</span>
<select id="optLang">
    @{
        var selectedLanguage = Xource.Helper.XourceHandler.GetLanguage();
        foreach (var language in Xource.Helper.XourceHandler.GetLanguagesInfo())
        {
            string selectedFlag = string.Empty;
            if (language.Equals(selectedLanguage)) {
                selectedFlag = "selected=\"selected\"";
            }
            <option value="@language.LCID" @selectedFlag>@language.DisplayName</option>
        }
    }
</select>

